{% extends 'TopxiaWebBundle:OpenCourseManage:open-course-layout.html.twig' %}

{% block title %}{{'基本信息'|trans}} - {{ parent() }}{% endblock %}

{% set side_nav = 'base' %}
{% set script_controller = 'course-manage/base' %}
{%
  set script_arguments = {
    categoryUrl: path('category_all'),
    tagMatchUrl: path('tag_match'),
    locationUrl: path('location_all')
  }
%}

{% block main %}

<div class="panel panel-default panel-col">
  <div class="panel-heading">{{'基本信息'|trans}}</div>
  <div class="panel-body">
    <form class="form-horizontal" id="course-form" method="post">

      {{ web_macro.flash_messages() }}

      <div class="form-group">
        <label class="col-md-2 control-label">{{'标题'|trans}}</label>
        <div class="col-md-8 controls">
          <input type="text" id="course_title" name="title" required="required" class="form-control" value="{{ course.title|default('') }}">
          <div class="help-block" style="display:none;"></div>
        </div>
      </div>

      <div class="form-group">
        <label class="col-md-2 control-label">{{'副标题'|trans}}</label>
        <div class="col-md-8 controls">
          <textarea id="course_subtitle" name="subtitle" required="required" class="form-control">{{ course.subtitle|default('') }}</textarea>
          <div class="help-block" style="display:none;"></div>
        </div>
      </div>

      <div class="form-group">
        <label class="col-md-2 control-label">{{'标签'|trans}}</label>
        <div class="col-md-8 controls">
          <input type="text" id="course_tags" name="tags" required="required" class="width-full select2-offscreen" tabindex="-1" value="{{ tags|join(',') }}" data-explain="{{'将会应用于按标签搜索课程、相关课程的提取等'|trans}}">
          <div class="help-block">{{'将会应用于按标签搜索课程、相关课程的提取等'|trans}}</div>
        </div>
      </div>

      <div class="form-group">
        <label class="col-md-2 control-label">{{'分类'|trans}}</label>
        <div class="col-md-8 controls">
          <select id="course_categoryId" name="categoryId" required="required" class="form-control width-input width-input-large">
            {{ select_options(category_choices('course'), course.categoryId, '分类'|trans) }}
          </select>
          <div class="help-block" style="display:none;"></div>
        </div>
      </div>

      <div class="form-group">
        <div class="col-md-2 control-label"><label>{{'课程简介'|trans}}</label></div>
        <div class="col-md-8 controls">
          <textarea name="about" rows="10" id="course-about-field" class="form-control" data-image-upload-url="{{ path('editor_upload', {token:upload_token('course')}) }}">{{ course.about }}</textarea>
        </div>
      </div>

      <div class="form-group">
        <div class="col-md-offset-2 col-md-8 controls">
            <button class="btn btn-fat btn-primary" id="course-create-btn" type="submit">{{'保存'|trans}}</button>
        </div>
      </div>

      <input type="hidden" name="_csrf_token" value="{{ csrf_token('site') }}">

    </form>
  </div>
</div>

{% endblock %}



